Conversation
|
Currently, some stuff like the Report Descriptor parser and error registry routine are copied from Linux and I think they are platform independent. Can we create a common directory or hidraw directory in code then put them inside? Have tested by the hidtest program. |
49a7a62 to
6e7a25a
Compare
|
Thanks for @Youw your review:). Then, What is your opinion about this?
|
I thinjk that is a good idea, but I don't think it really is nesessary to do so in scope of this PR. |
|
Nice. This will address the following issue. |
|
Oops. I forget we have udev-devd stuff. Maybe we should use udev also? |
I lost context here. What for? Seem like you have all the functionality implemented already. Aren't you? |
Yes, all functionality is fully implemented. I am just thinking if we should use libudev make hidapi more portable. |
|
First test under FreeBSD 14.1 Release, under a physical machine (Chuwi mini PC, Intel J4125 CPU, 8GB RAM, 256GB SSD) There are a few compiler warnings. |
|
Fix it:). Forget to fix the warning. |
|
Somehow hidtest-hidraw will seg fault with the Microchip Simple HID example. |
Thanks. The compiler warnings are gone. The Segfault issue is still there though. |
Although some reluctance it seems to provide reasonable and constructive review at least there will be some hints :-) |
|
I don't see any huge change over behavior. The comments from AI are just missing boundary checks. |
Hi. I just take a look at this again. Could you please try to make your payload 128bytes? |
Yes, I will try to carry out some tests over the weekend and report the results from FreeBSD 15.0 release. |
|
Here are the latest test results under FreeBSD 15.0 release. |
|
Summary of the above test for the EZ-USB FX2LP modified Generic HID example with 128 Bytes report size (high speed USB device).
|
|
Sanity check under Windows, with latest hidapi git. |
Does output of payload less than 128 bytes work? FreeBSD check if the device can handle the report by checking the size in report descriptor. You report descriptor shows that we can only handle 128 bytes. |
usbhid allocates internal buffers based on report size. They are 128 bytes long in that case. 129 bytes wont fit them. There is a difference between input and output unnumbered reports. |
This is under Linux. Linux hidraw backend does not work if I send 64 bytes payload. |
|
Ouch. It seems that input is really 128 bytes no 129. |
That should be the correct one. The report ID 00 for the output report is not really on the wire. It is more needed because of Windows native HID API. |
|
Strange. I have just tested FreeBSD hidraw on MBP8,1 with USB touchpad. Touching of surface with all 10 fingers gave me 338bytes packets successfully received. |
Good one. Do you have any High Speed USB HID device? As I mentioned before, "forcing the device to run in Full Speed mode and now this PR works". So your device is most likely a Full Speed USB device. Latest version of VirtualBox does not seem to allow me to disable EHCI support so I can not carry out the test. I am not so sure if I still have working USB 1.1 Hub to try. |
|
On the other hand, High Speed USB HID device is probably rare. In that case, we may still want to merge this PR first and then debug the issue later. Maybe it has nothing to do with this PR but rather the hidraw (usbhid driver) of FreeBSD. |
It is Full Speed device. |
|
|
Going back to original FX2HID example from Jan Axelson, this PR still does not work. No issues under Windows. No issues under FreeBSD with the libusb backend. This PR still does not work. |
Thanks for the tip. I will try this soon. |
Somehow this does not work. The device is still enumerated as a high speed USB device. |
|
The following command seems to disable EHCI driver completely, but then somehow I cannot attach the FX2LP USB HID device. Only a generic Atmel STK600 can be attached. |
|
Okay, this seems to work. Now it seems to work. |
|
Going back to the device with HID Input/Output report size of 128 bytes. It seems to this PR will work fine as well. Good thing -- PR #728 also works fine. |
|
I am still in favour of merging this PR after your review. The reason is that High Speed USB HID devices are not that common. But you can decide. |
It is definitely FreeBSD usbhid issue or may be bad interaction between FreeBSD and VBox. |
I will test with a physical machine tomorrow. |
I will do a quick reviw from the AI comment again and do rebasing tomorrow. |
Ah yes. Sorry for missing this. |
FreeBSD support hidraw in Kernel from 13.0.
By using libusb only, we can only see the HID device from usb. To address this, we implement hidraw backend for FreeBSD.
Just like Linux use libudev to handle usb specified HID stuff (like Manufacture), we use libusb to handle it.
Sponsored-by: FreeBSD Foundation